﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcs.Web.project
{
    public partial class listmy : Web.Admin.BasePage
    {
        Maticsoft.BLL.project bll = new Maticsoft.BLL.project();
        lcs.BLL.user bu = new BLL.user();
        public string dogid = "NO";
        public string Decode(string str)
        {

            if (dogid == "NO")
            {
                if (Request.Cookies["dogid"] != null)
                    dogid = Request.Cookies["dogid"].Value.ToString();
            }
            return DecodeDog(str, dogid);

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {               
                BindData();
            }
            Page.DataBind();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            BindData();
        }
        public void BindData()
        {

            DataSet ds = new DataSet();
            StringBuilder strWhere = new StringBuilder();
            if (txtKeyword.Text.Trim() != "")
            {
                if (Decode("1") == "1")
                    strWhere.AppendFormat(" and projectName like '%{0}%'", txtKeyword.Text.Trim());
            }
            int uid = getid();
            
            strWhere.Append(" and user_id ="+uid);
            
            ds = bll.GetListV(strWhere.ToString());
            gridView.DataSource = ds;
            gridView.DataBind();
        }

        protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gridView.PageIndex = e.NewPageIndex;
            BindData();
        }
        protected void gridView_OnRowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                //e.Row.Cells[0].Text = "<input id='Checkbox2' type='checkbox' onclick='CheckAll()'/><label></label>";
            }
        }
        protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            e.Row.Attributes.Add("style", "background:#FFF");
        }

        protected void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //#warning 代码生成警告：请检查确认真实主键的名称和类型是否正确
            //int ID = (int)gridView.DataKeys[e.RowIndex].Value;
            //bll.Delete(ID);
            //gridView.OnBind();
        }

    }
}